﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Code.Commen
{
    public class Key<K1, K2>
    {
        public Key(K1 p1, K2 p2)
        {
            Propertie1 = p1;
            Propertie2 = p2;
        }
        /// <summary>
        /// K1所对应的值
        /// </summary>
        public K1 Propertie1 { get; set; }
        /// <summary>
        /// K2所对应的值
        /// </summary>
        public K2 Propertie2 { get; set; }

        public override bool Equals(object obj)
        {
            if (obj is Key<K1, K2>)
            {
                var value = (Key<K1, K2>)obj;
                return this.Propertie1.Equals(value.Propertie1) && this.Propertie2.Equals(value.Propertie2);
            }
            return false;
        }
        public override int GetHashCode()
        {
            return this.Propertie1.GetHashCode() & this.Propertie2.GetHashCode();
        }
    }

    public class Key<K1, K2, K3>
    {
        public Key(K1 p1, K2 p2,K3 p3)
        {
            Propertie1 = p1;
            Propertie2 = p2;
            Propertie3 = p3;
        }
        /// <summary>
        /// K1所对应的值
        /// </summary>
        public K1 Propertie1 { get; set; }
        /// <summary>
        /// K2所对应的值
        /// </summary>
        public K2 Propertie2 { get; set; }
        /// <summary>
        /// K3所对应的值
        /// </summary>
        public K3 Propertie3 { get; set; }

        public override bool Equals(object obj)
        {
            if (obj is Key<K1, K2,K3>)
            {
                var value = (Key<K1, K2,K3>)obj;
                return this.Propertie1.Equals(value.Propertie1) && this.Propertie2.Equals(value.Propertie2)&&this.Propertie2.Equals(value.Propertie3);
            }
            return false;
        }
        public override int GetHashCode()
        {
            return this.Propertie1.GetHashCode() & this.Propertie2.GetHashCode()&this.Propertie3.GetHashCode();
        }
    }

    public class Key<K1, K2, K3, K4>
    {
        public Key(K1 p1, K2 p2,K3 p3,K4 p4)
        {
            Propertie1 = p1;
            Propertie2 = p2;
            Propertie3 = p3;
            Propertie4 = p4;
        }
        /// <summary>
        /// K1所对应的值
        /// </summary>
        public K1 Propertie1 { get; set; }
        /// <summary>
        /// K2所对应的值
        /// </summary>
        public K2 Propertie2 { get; set; }
        /// <summary>
        /// K3所对应的值
        /// </summary>
        public K3 Propertie3 { get; set; }
        /// <summary>
        /// K4所对应的值
        /// </summary>
        public K4 Propertie4 { get; set; }

        public override bool Equals(object obj)
        {
            if (obj is Key<K1, K2,K3,K4>)
            {
                var value = (Key<K1, K2,K3,K4>)obj;
                return this.Propertie1.Equals(value.Propertie1) && this.Propertie2.Equals(value.Propertie2)&&this.Propertie1.Equals(value.Propertie3)&&this.Propertie1.Equals(value.Propertie4);
            }
            return false;
        }
        public override int GetHashCode()
        {
            return this.Propertie1.GetHashCode() & this.Propertie2.GetHashCode()&this.Propertie3.GetHashCode()&this.Propertie4.GetHashCode();
        }

    }
}
